#[derive(Debug, Clone, PartialEq)]
pub enum Error {
	Eof,
	Msg(&'static str),
	Expect(String, Option<String>),
	Unexpect(String),
	HexEmpty,
	Integer(core::num::ParseIntError),
	Real(core::num::ParseFloatError),
}
impl core::error::Error for Error {}
impl core::fmt::Display for Error {
	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
		match self {
			Error::Msg(s) => f.write_str(s),
			Error::Integer(error) => error.fmt(f),
			Error::Real(error) => error.fmt(f),
			Error::Eof => f.write_str("Eof"),
			Error::HexEmpty => f.write_str("HexEmpty"),
			Error::Expect(e, Some(fd)) => f.write_fmt(format_args!("expect {},found {}", e, fd)),
			Error::Expect(e, None) => f.write_fmt(format_args!("expect {}", e)),
			Error::Unexpect(s) => f.write_fmt(format_args!("unexpect {}", s)),
		}
	}
}
impl From<&'static str> for Error {
	fn from(value: &'static str) -> Self {
		Self::Msg(value)
	}
}
